package com.smart.support.controller;

import com.smart.common.entities.ajax.AjaxResult;
import com.smart.common.entities.constant.SmartConstant;
import com.smart.common.entities.option.SelectOption;
import com.smart.manager.pop.repository.DisLevelRepository;
import com.smart.manager.pop.repository.PopLinkRepository;
import com.smart.manager.pop.repository.PopPosterRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Xiaxuqiu
 * @description 作用描述
 * @date 2023-04-01
 **/
@Api(tags = "活动中心")
@RestController
@Log4j2
@RequestMapping(SmartConstant.MANAGER_API_PREFIX + "pop/support")
@RequiredArgsConstructor
public class PopApi {

    private final PopPosterRepository popPosterRepository;
    private final PopLinkRepository linkRepository;
    private final DisLevelRepository disLevelRepository;

    @ApiOperation(value = "获取海报字典")
    @GetMapping("posterOptions")
    public AjaxResult<List<SelectOption>> getPosterOptions() {
        List<SelectOption> result = popPosterRepository.getOptions();
        return AjaxResult.data(result);
    }



    @ApiOperation(value = "获取海报字典")
    @GetMapping("linkOptions")
    public AjaxResult<List<SelectOption>> getLinkOptions() {
        List<SelectOption> result = linkRepository.getOptions();
        return AjaxResult.data(result);
    }



    @ApiOperation(value = "获取等级字典")
    @GetMapping("levelOptions")
    public AjaxResult<List<SelectOption>> getLevelOptions() {
        List<SelectOption> result = disLevelRepository.getOptions();
        return AjaxResult.data(result);
    }


}
